package com.ilancuo.clazz;

import java.util.ArrayList;
import java.util.List;

class Apple {
    class Type {
    }
}

public class ClassType {
    public static void main(String[] args) {
        Apple apple = new Apple();
        System.out.println(apple.getClass().getSimpleName()); // Apple
        System.out.println(apple.getClass().getName()); // com.ilancuo.clazz.Apple
        System.out.println(apple.getClass().getCanonicalName()); // com.ilancuo.clazz.Apple
        System.out.println("--------------------------------------------");

        Apple[] apples = new Apple[]{};
        System.out.println(apples.getClass().getSimpleName()); // Apple[]
        System.out.println(apples.getClass().getName()); // [Lcom.ilancuo.clazz.Apple;
        System.out.println(apples.getClass().getCanonicalName()); // com.ilancuo.clazz.Apple[]
        System.out.println("--------------------------------------------");

        List<Apple> list = new ArrayList<>();
        System.out.println(list.getClass().getSimpleName()); // ArrayList
        System.out.println(list.getClass().getName()); // java.util.ArrayList
        System.out.println(list.getClass().getCanonicalName()); // java.util.ArrayList
        System.out.println("--------------------------------------------");

        System.out.println(int.class.getSimpleName()); // int
        System.out.println(int.class.getName()); // int
        System.out.println(int.class.getCanonicalName()); // int
        System.out.println("--------------------------------------------");

        System.out.println(String.class.getSimpleName()); // String
        System.out.println(String.class.getName()); // java.lang.String
        System.out.println(String.class.getCanonicalName()); // java.lang.String
        System.out.println("--------------------------------------------");

        System.out.println(Apple.Type.class.getSimpleName()); // Type
        System.out.println(Apple.Type.class.getName()); // com.ilancuo.clazz.Apple$Type
        System.out.println(Apple.Type.class.getCanonicalName()); // com.ilancuo.clazz.Apple.Type
        System.out.println("--------------------------------------------");

        System.out.println(args.getClass().getSimpleName()); // String[]
        System.out.println(args.getClass().getName()); // [Ljava.lang.String;
        System.out.println(args.getClass().getCanonicalName()); // java.lang.String[]
    }
}
